package betandregret;

import java.util.ListIterator;

public class SportartCollection extends Collection<Sportart>{

	public Sportart findeSportart(int sportartID) {
		ListIterator<Sportart> iterator = liste.listIterator();
		
		while(iterator.hasNext()){
			Sportart currentSportart= iterator.next();
			if (sportartID == currentSportart.getId()){
				return currentSportart;
			}
		}
		return null;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder();
		
		ListIterator<Sportart> iterator = liste.listIterator();
		while(iterator.hasNext()){
			Sportart spart = iterator.next();
			TeamCollection teams = spart.getTeams();
			sb.append( spart.toString() + '\n'+ teams.toString());
		}	
		return sb.toString();
		
	}
}
